const http = require('http')
const fs = require('fs')
const path = require('path')

const server = http.createServer()

server.on('request', function (req, res) {
    let url = req.url;
    console.log(url);
    if(url==="/") url="/index.html";
    fs.readFile(path.join(__dirname,url),(err,datas)=>{
        if(err) return  res.end(datas);
        res.end(datas);
    })
})

server.listen(3300, () => {
  console.log('server running at http://127.0.0.1:3000')
})